<!--#include virtual="/dzps/p1.asp"-->

<%
dim action,ret,sql,rs,json
json = request.form
action=Easp.Var("action")
if action="prj_del_sel" then
	prj_del_sel
elseif action="t_del_sel" then
	t_del_sel	
elseif action="c_del_sel" then
	c_del_sel
elseif action="u_del_sel" then
	u_del_sel
elseif action="del_seluser" then
	del_seluser
end if
Function t_del_sel()
	dim result,ob,i,ids,ret
	Set ob = toArray(json)
	For i=0 To ob.Count-1
		easp.var("id")=ob(i)("id")
		ret = Easp.Db.del("prj_table","id={id:int}")
	next
	Set ob = Nothing
End Function

Function del_seluser()
	dim result,ob,i,ids,ret
	Set ob = toArray(json)
	For i=0 To ob.Count-1
		' ids=ids&ob(i)("ID") & "," 
		easp.var("id")=ob(i)("id")
		if ob(i)("username")<>"admin" then
			ret = Easp.Db.del("user","id={id:int}")
		end if
	next
	Set ob = Nothing
End Function
Function u_del_sel()
	dim result,ob,i,ids,ret
	Set ob = toArray(json)
	For i=0 To ob.Count-1
		easp.var("id")=ob(i)("id")
		ret = Easp.Db.del("u","id={id:int}")
	next
	Set ob = Nothing
End Function
Function c_del_sel()
	dim result,ob,i,ids,ret
	Set ob = toArray(json)
	For i=0 To ob.Count-1
		easp.var("id")=ob(i)("id")
		ret = Easp.Db.del("center","id={id:int}")
	next
	Set ob = Nothing
End Function
Function prj_del_sel()
	dim result,ob,i,ids,ret

	Set ob = toArray(json)

	For i=0 To ob.Count-1
		' ids=ids&ob(i)("ID") & "," 
		easp.var("id")=ob(i)("id")
		' if ob(i)("username")<>"admin" then
			ret = Easp.Db.del("prj","id={id:int}")
		' end if
	next
	Set ob = Nothing
End Function
function x1()
dim json
json="[{'id':1,'cn':'衷心','f1':null,'f2':null,'f3':null},{'id':6,'cn':'www','f1':null,'f2':null,'f3':null},{'id':7,'cn':'aaaaaa','f1':null,'f2':null,'f3':null},{'id':10,'cn':'aaa1111','f1':null,'f2':null,'f3':null}]"
' easp.echo json
	dim result,ob,i,ids
	Set ob = toArray(json)
	For i=0 To ob.Count-1
	  ids=ids&ob(i)("id") & "," 
	  ' easp.echo ids
	next
	Set ob = Nothing
end function
	
Function js4(fn,tn,title,zdy1,zdy1_title) 
	dim txt
	txt=myr(fn)
	txt=replace(txt,"[dy:tn]",tn)
	txt=replace(txt,"[dy:title]",title)
	txt=replace(txt,"[dy:zdy1]",zdy1)
	txt=replace(txt,"[dy:zdy1_title]",zdy1_title)
	js4=txt
	' Easp.Echo txt
End Function

Function js3(fn,field,title,width) 
	dim txt
	txt=myr(fn)
	txt=replace(txt,"[dy:field]",field)
	txt=replace(txt,"[dy:title]",title)
	if width<>"" then 
		txt=replace(txt,"100",width)
	end if
	js3=txt
	' Easp.Echo txt
End Function
Function js2(fn,fien,label,val) 
	dim txt
	txt=myr(fn)
	txt=replace(txt,"[dy:fieldn]",fien)
	txt=replace(txt,"[dy:label]",label)
	txt=replace(txt,"[dy:value]",val)
	js2=txt
	' Easp.Echo txt
End Function

Function getCheckData()
	dim result,ob,i,ids
	Set ob = toArray(json)
	For i=0 To ob.Count-1
	  ids=ids&ob(i)("ID") & "," 
	next
	easp.var("ids")=left(ids,len(ids)-1)
	Set ob = Nothing	
	result=easp.db.del("jf","id in ({ids})")
End Function
Function ret2(ret)
	if ret=1 then
		retJson "0","成功",""
	else
		retJson "0","失败",""
	end if
End Function

Function ret1(ret)
	if ret=1 then
		easp.echo "1"
	else
		easp.echo "0"
	end if
End Function

Function txt2file(txt)
	WriteToTextFile "D:\wwwroot\wlh_jh8tfd\web\src\" & "layuiadmin\tpl\lse\1\" & session("username") &"" & ".txt",txt,"UTF-8"
End Function

Function myr2 (FileUrl,CharSet)
	FileUrl="D:\wwwroot\wlh_jh8tfd\web\src\" & "layuiadmin\tpl\lse\1\" & FileUrl
	Easp.Echo FileUrl
	Easp.Echo ReadFromTextFile(FileUrl,"UTF-8")
End Function

Function ReadFromTextFile (FileUrl,CharSet)
	dim stm,str
	set stm=server.CreateObject("adodb.stream")
	stm.Type=2 '以本模式读取
	stm.mode=3
	stm.charset=CharSet
	stm.open
	stm.loadfromfile FileUrl
	str=stm.readtext
	stm.Close
	set stm=nothing
	ReadFromTextFile=str
End Function
Sub WriteToTextFile (FileUrl,byval Str,CharSet)
	dim stm
	set stm=server.CreateObject("adodb.stream")
		stm.Type=2 '以本模式读取
		stm.mode=3
		stm.charset=CharSet
		stm.open
		stm.WriteText str
		stm.SaveToFile FileUrl,2
		stm.flush
		stm.Close
	set stm=nothing
End Sub

Function syh(txt)
	txt = chr(34)&txt&chr(34)
	syh=txt
End Function

Function da(txt)
	txt = chr(39)&txt&chr(39)
	da=txt
End Function

Function lbfh(txt)
	txt=da("%"&txt&"%")
	lbfh=" like " & txt
End Function

Function bfh(txt)
	txt=da("%"&txt&"%")
	bfh=txt
End Function

Function dkh(txt)
	txt="{"&txt&"}"
	dkh=txt
End Function

Function xkh(txt)
	txt="("&txt&")"
	xkh=txt
End Function

Function daj(txt)
	txt = "#" & txt& "#"
	daj=txt
End Function

Function xg(tn,field,w)
    dim fielda,s,i
	fielda=split(field,",")
	s="update " & tn &" set "
	for i=0 to ubound(fielda)
		fielda(i)=replace(fielda(i),"[","")
		fielda(i)=replace(fielda(i),"]","")
		s=s+fielda(i)+"="+dkh(fielda(i))+","
	next
	s=left(s,len(s)-1) 
	xg=s+" where "+w
End Function

Function xg2(tn,field,w)
    dim fielda,s,i
	fielda=split(field,",")
	s="update " & tn &" set "
	for i=0 to ubound(fielda)
		fielda(i)=replace(fielda(i),"[","")
		fielda(i)=replace(fielda(i),"]","")
		s=s+fielda(i)+"="+dkh(hr_1(fielda(i)))+","
	next
	s=left(s,len(s)-1) 
	xg2=s+" where "+w
End Function

Function cr2(tn,field)
    dim fielda,s,i
	fielda=split(field,",")
	s="insert into " & tn & xkh(field) & " values ("
	for i=0 to ubound(fielda)
		fielda(i)=replace(fielda(i),"[","")
		fielda(i)=replace(fielda(i),"]","")
		s=s+dkh(hr_1(fielda(i)))+","
	next
	s=left(s,len(s)-1) & ")"
	cr2=s
End Function
Function cr(tn,field)
    dim fielda,s,i
	fielda=split(field,",")
	s="insert into " & tn & xkh(field) & " values ("
	for i=0 to ubound(fielda)
		fielda(i)=replace(fielda(i),"[","")
		fielda(i)=replace(fielda(i),"]","")
		s=s+dkh(fielda(i))+","
	next
	s=left(s,len(s)-1) & ")"
	cr=s
End Function
Function hr_1(txt)
	hr_1="field[" & txt & "]"
End Function

Function getCheckData()
	dim result,ob,i,ids
	Set ob = toArray(json)
	For i=0 To ob.Count-1
	  ids=ids&ob(i)("ID") & "," 
	next
	easp.var("ids")=left(ids,len(ids)-1)
	Set ob = Nothing	
	result=easp.db.del("jf","id in ({ids})")
End Function
Function batchQrjf()
	dim result,ob,i,ids,ret
	Set ob = toArray(json)
	For i=0 To ob.Count-1
		' ids=ids&ob(i)("ID") & "," 
		easp.var("id")=ob(i)("ID")
		set rs=easp.db.sel("select qrjf from [jf] where id={id}")
		if rs("qrjf")=0 then
			ret=Easp.Db.Upd ("[jf]","qrjf=1","id={id}")    	
		end if
	next
	Set ob = Nothing
End Function

Function execsw(sqla)
	dim result,i
	easp.db.begin
	' sqla=split(sqls,";")
	for i=0 to ubound(sqla)
		if sqla(i)<>"" then
			result=easp.db.query(sqla(i))
			if not result then
				exit for
			end if
		end if
	next 
	if i<=ubound(sqla) then
		easp.db.RollBack
		execsw=0
	else
		easp.db.Commit
		execsw=1
	end if
End Function

Function retJson(code,msg,data)
		Easp.Echo "{" & syh("code") & ":"&code&","  & syh("msg") & ":" & syh(msg) & "," & syh("data") & ":{}"&"}"
End Function

Function clearSession()
	session("username")=""
	session("password")=""
	session("mc")=""
	session("jxs")=""
	session("gdbs")="0"			
End Function
%>